package main

import (
	"HSP/engine"
	"HSP/utils"
	"flag"
	"fmt"
	"path/filepath"
	"time"
)

var f = flag.String("f", "", "文件地址")

func main() {
	flag.Parse()
	*f = "./js/index.js"
	if *f != "" {
		content, err := utils.GetFileContent(*f)
		if err == nil {
			dir, _ := filepath.Split(*f)
			engine.StartEngine(dir)
			engine.Exec(content)
		} else {
			fmt.Println(err)
		}
	} else {
		fmt.Println("-f 参数缺少")
	}
	time.Sleep(time.Duration(10) * time.Second)
}
